
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Kid_goth
 */

public class clsEncript 
{
    public String Crypt(String text)
    {
        StringBuffer h = null;
        try
        {
            MessageDigest md = MessageDigest.getInstance("MD5");
            byte[] b = md.digest(text.getBytes());

            int size = b.length;
            h = new StringBuffer(size);
            for (int i = 0; i < size; i++) 
            {
                int u = b[i] & 255;
                if (u < 16) 
                {
                    h.append("0" + Integer.toHexString(u));
                } 
                else 
                {
                    h.append(Integer.toHexString(u));
                }
            }
        }
        catch(NoSuchAlgorithmException ex)
        {
            ex.printStackTrace();
        }
        return h.toString();
    }
}
